package DP.mediator;

import DP.mediator.colleague.impl.ConcreteColleague1;
import DP.mediator.colleague.impl.ConcreteColleague2;
import DP.mediator.medi.impl.ConcreteMediator;
import DP.mediator.medi.Mediator;

/**
 * @author msi
 * 场景类
 */
public class Client {
    public static void main(String[] args) {
        //创建中介者类
        Mediator mediator=new ConcreteMediator();
        //将具体同事类注入中介者类
        ConcreteColleague1 concreteColleague1=new ConcreteColleague1(mediator);
        ConcreteColleague2 concreteColleague2=new ConcreteColleague2(mediator);
        mediator.setC1(concreteColleague1);
        mediator.setC2(concreteColleague2);

        concreteColleague1.selfMethod1();
        concreteColleague1.depMethod1();
    }
}
